use Dosvid
go

if exists(select 1
		  from sysobjects
		  where name = 'SentEmailsHistory')
  drop table SentEmailsHistory
go

create table SentEmailsHistory
(
  Id int identity(1,1) not null,
  CandidatId int not null,
  EMail nvarchar(255) not null,
  SendDate datetime not null
)  
go

alter table SentEmailsHistory add constraint PK_SentEmailsHistory_ID primary key(Id) 
go


alter table SentEmailsHistory add constraint FK_SentEmailsHistory_Candidates_CandidatId 
      foreign key (CandidatId) references Candidates(Id)
go

create nonclustered index IX_SentEmailsHistory_CandidatId on SentEmailsHistory
       (CandidatId asc, EMail asc)
go

